package com.zx.service.impl;

import com.zx.entity.Order;
import com.zx.mapper.OrderMapper;
import com.zx.service.OrderService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @author jack.wu
 * @version 1.0
 * @date 2020-03-11
 */
@Slf4j
@Service
public class OrderServiceImpl implements OrderService {

    @Resource
    private OrderMapper orderMapper;

    @Override
    public Order findById(Long id) {
        return orderMapper.findById(id).get();
    }

    @Override
    public Order addOrder(Order order) {
        return orderMapper.save(order);
    }

    @Override
    public Order updateOrder(Order order) {
        return orderMapper.save(order);
    }

    @Override
    public void deleteById(Long id) {
        orderMapper.deleteById(id);
    }
}
